<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>test</title>
</head>
<body>
<script>
    function foo() {
        return function f() {
            f.age = 24
            f.getAge = function () {
                return f.age
            }
            f.setAge = function (age) {
                f.age = age
            }

        }
    }

    let res = foo()
    console.log(res())
    console.log(res.age)


</script>
</body>
</html>